package com.lyf.network.practice.nio.chartroom;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;

/**
 * @author LYF
 * @date 2022/6/24
 */
public class NioClient {
    static void start() throws IOException {
//        Selector selector = Selector.open();

        SocketChannel socketChannel = SocketChannel.open(new InetSocketAddress("127.0.0.1",8899));
//
//        socketChannel.configureBlocking(false);

//        socketChannel.register(selector, SelectionKey.OP_ACCEPT);
//
//        socketChannel.connect(new InetSocketAddress("127.0.0.1",8899));


        socketChannel.write(Charset.forName("UTF-8").encode("hello"));


    }
    public static void main(String[] args) throws IOException {
        start();
    }
}
